package org.wzq.gradle_learn;
import java.io.*;
/**
 * project:
 * author: wzq
 * date: 2014/8/5
 * description:
 */
public class Test4Gradle {
    public static void main(String[] args) {
        System.out.println(" Test4Gradle start :arg[0]=" + args[0]);
        //System.out.println(System.getProperty("simple.message") + args[0] + " from Simple.");

        //
        File f = new File("Test4Gradle");
        f.mkdirs();

        // copy file
        String file1 = "src/main/assets/todo/fileF.txt";
        String file2 = "Test4Gradle/fileF.txt";

        try {
            copyFile(file1, file2); // ok
            new AesTool("myPwd").encryptFile(file1);
            System.out.println(" Test4Gradle over ");
        } catch(IOException e) {
            e.printStackTrace();
        }
        System.exit(0);
    }

    private static void copyFile(String src, String dst) throws IOException {
        InputStream srcStream = new FileInputStream(new File(src));
        OutputStream dstStream = new FileOutputStream(new File(dst));

        byte[] buf = new byte[1024];
        int numRead;
        while((numRead = srcStream.read(buf)) > 0) {
            dstStream.write(buf, 0, numRead);
        }
        srcStream.close();
        dstStream.close();
    }
}
